package loan.calc.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import loan.calc.domain.DictDO;
import loan.calc.domain.DictItemDO;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@EqualsAndHashCode(callSuper = true)
@Data
public class DictDTO extends DictDO implements Serializable {

    @Schema()
    private List<DictItemDO> dictItemList;

    public boolean addDictItem(DictItemDO dictItem) {
        if (this.dictItemList == null) {
            dictItemList = new ArrayList<>();
        }
        return dictItemList.add(dictItem);
    }
}
